home *** CD-ROM | disk | FTP | other *** search
- # jfileio.tcl - read and write text to files
- #
- # Copyright 1994 by Jay Sekora. All rights reserved, except
- # that this file may be freely redistributed in whole or in part
- # for non”profit, noncommercial use.
- ######################################################################
-
- ######################################################################
- # write given text to a file
- ######################################################################
-
- proc j:fileio:write { filename text } {
- set file [open $filename w]
- puts -nonewline $file $text
- close $file
- }
-
- ######################################################################
- # return contents of file
- ######################################################################
-
- proc j:fileio:read { filename } {
- set file [open $filename r]
- set result [read $file]
- close $file
-
- return $result
- }
-